package com.example.administrator.maizuofilm.cinema.fragment;

import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;

/**
 * Created by a on 2016/7/12.
 */
public class CinemaPresenter implements CinemaContract.Presenter {
    private CinemaContract.Model mModel;
    private CinemaContract.View mView;

    public CinemaPresenter(CinemaContract.View view, CinemaContract.Model model) {
        this.mView = view;
        this.mModel = model;
        EventBus.getDefault().register(this);
    }

    @Override
    public void init() {
        mModel.init();
    }

    @Subscribe(threadMode = ThreadMode.MAIN)
    public void sub(String json) {
        if (json == null) {
            mView.onInitFail("cuowu");
        } else {
            mView.onInitSuccess(json);
        }
    }
}
